<div>
  <div class="main-title">
    <h2>栏目管理</h2>
  </div>
  <div class="main-section form-inline">
    <a href="/admin/category/edit" class="btn btn-success">+ 新增</a>
  </div>
  <div class="main-section">
    <table class="table table-striped table-bordered table-hover">
      <thead>
        <tr>
          <th>栏目名称</th>
          <th>排序值</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
        {if $category}
        {foreach $category as $v}
        <tr>
          <td><a href="/admin/category/edit?id={$v.id}">{$v.name}</a></td>
          <td>{$v.sort}</td>
          <td>
            <a href="/admin/category/edit?id={$v.id}" style="margin-right:5px;">编辑</a>
            <a href="/admin/category/delete?id={$v.id}" class="j-del text-danger">删除</a>
          </td>
        </tr>
        {/foreach}
        {else}
        <tr>
          <td colspan="3" class="text-center">列表为空</td>
        </tr>
        {/if}
      </tbody>
    </table>
  </div>
</div>
<script>
  main.menuActive('category');
  $('.j-del').click(function () {
    if (confirm('您确定要删除此项？')) {
      main.ajaxPost($(this).attr('href'), function () {
        main.contentRefresh();
      });
    }
    return false;
  });
</script>